import request from '@/utils/request'

// 查询采购申请单列表
export function listPurchase(query) {
  return request({
    url: '/purchase/purchase/list',
    method: 'get',
    params: query
  })
}

// 查询采购申请单详细
export function getPurchase(id) {
  return request({
    url: '/purchase/purchase/' + id,
    method: 'get'
  })
}

// 新增采购申请单
export function addPurchase(data) {
  return request({
    url: '/purchase/purchase',
    method: 'post',
    data: data
  })
}


export function addPurchaseAll(data) {
  return request({
    url: '/purchase/purchase/addAll',
    method: 'post',
    data: data
  })
}


// 修改采购申请单
export function updatePurchase(data) {
  return request({
    url: '/purchase/purchase',
    method: 'put',
    data: data
  })
}

// 采购单发起申请
export function applyPurchase(data) {
  return request({
    url: '/purchase/purchase/apply',
    method: 'put',
    data: data
  })
}


// 采购申请---审核处理,通过拒绝
export function handlerAudit(data) {
  return request({
    url: '/purchase/purchase/handler/audit',
    method: 'put',
    data: data
  })
}

// 删除采购申请单
export function delPurchase(id) {
  return request({
    url: '/purchase/purchase/' + id,
    method: 'delete'
  })
}
